/****************************************\
|* MFZPSP LLE PSP Emulator              *|
|* Copyright (c) 2008 Mauro Frischherz  *|
|* See License.txt for details          *|
\****************************************/

#include "functions.h"
#include "../types.h"
#include <string.h>
#include <stdio.h>
#include <ctype.h>

int GetFileType(const char* path)
{
	int type = FILE_TYPE_NULL;
	
	int len = strlen(path);
	char extension[4];
	
	// Get extension
	extension[0] = path[len - 3];
	extension[1] = path[len - 2];
	extension[2] = path[len - 1];
	extension[3] = '\0';
	
	extension[0] = tolower(extension[0]);
	extension[1] = tolower(extension[1]);
	extension[2] = tolower(extension[2]);


	if(strcmp(extension, "pbp") == 0)
		type = FILE_TYPE_PBP;
	else if(strcmp(extension, "elf") == 0)
		type = FILE_TYPE_ELF;
	
	return type;
}

